<table>
    <tr>
        <td colspan="8">{{ \App\Models\Purchase\PurchaseOrderContract::$_partyA[$param['party_a']] }}采购合同</td>
    </tr>
    <tr>
        <td>采购单号：</td>
        <td>{{ $purchase->purchase_no }}</td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td>签订日期：</td>
        <td>{{ date('Y/m/d',strtotime($purchase->created_at)) }}</td>
    </tr>
    <tr>
        <td>甲方：</td>
        <td>{{ \App\Models\Purchase\PurchaseOrderContract::$_partyA[$param['party_a']] }}</td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td>电话(Tel)：</td>
        <td>{{ $param['party_a_tel'] }}</td>
    </tr>
    <tr>
        <td>地址：</td>
        <td colspan="7">{{ $param['party_a_address'] }}</td>
    </tr>
    <tr>
        <td>乙方：</td>
        <td>{{ $param['party_b'] }}</td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td>电话(Tel)：</td>
        <td>{{ $param['party_b_tel'] }}</td>
    </tr>
    <tr>
        <td>地址：</td>
        <td colspan="7">{{ $param['party_b_address'] }}</td>
    </tr>
    <tr>
        <td>联系人：</td>
        <td colspan="3">{{ $param['contact_person'] }}</td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
    </tr>
    <tr>
        <td colspan="8">经甲乙双方确认根据下列条款订立本合同：</td>
    </tr>
    <tr>
        <th>SKU|ModelNo</th>
        <th>产品名称</th>
        <th>图片</th>
        <th>产品描述</th>
        <th>单价(RMB)</th>
        <th>数量(PCS)</th>
        <th>总额(RMB)</th>
        <th>交货日期</th>
    </tr>
    @foreach($purchase->order_detail as $item)
        @if($item->order_num != 0)
            <tr>
                <td>{{ $item->sku->psku_code ?? '' }}|{{ $item->skuClassify->model_no ?? '' }}</td>
                <td>{{ $item->sku->psku_cn ?? '' }}</td>
                <td>
                    @if(!isset($item->sku->img) || !$item->sku->img)
                        {{ "/" }}
                    @else
                        {{ \App\Models\Product\ProductSku::getMainImageSrc($item->sku->img) }}
                    @endif
                </td>
                <td>
                    @if(!isset($param[$item->id]['describe']) || !$param[$item->id]['describe'])
                        {{ "/" }}
                    @else
                        <pre>{{ $param[$item->id]['describe'] }}</pre>
                    @endif
                </td>
                <td>{{ $item->supplier_price }}</td>
                <td>{{ $item->order_num }}</td>
                <td>{{ round($item->supplier_price * $item->order_num,3) }}</td>
                <td>{{ date('Y-m-d',strtotime('-7 days',strtotime($purchase->commit_date))) }}</td>
            </tr>
        @endif
    @endforeach
    <tr>
        <td>合计</td>
        <td>{{ $param['tax'] }}</td>
        <td>{{ \App\Models\Basics\Supplier::$_shipFeeType[$param['ship_fee_type']] }}</td>
        <td></td>
        <td></td>
        <td>{{ $orderNum ?: "/" }}</td>
        <td>{{ $orderAmount ?: "/" }}</td>
        <td></td>
    </tr>
    <tr>
        <td colspan="8">{{ $param['protocol'] }}</td>
    </tr>
    <tr>
        <td>甲方代表人签名</td>
        <td>{{ $param['username'] }}</td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td>乙方代表人签名</td>
        <td></td>
    </tr>
    <tr>
        <td>盖章</td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td>盖章</td>
        <td></td>
    </tr>
    <tr>
        <td>签订日期</td>
        <td>{{ date('Y/m/d',strtotime($purchase->order_at)) }}</td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td>签订日期</td>
        <td></td>
    </tr>
</table>
